const readline = require("readline-sync");
var input = readline.question("请输入两个数字 用空格分开;");
var a = input.split(' ')[0];
var b = input.split(' ')[1];

console.log(gongyueshu(a,b));

function gongyueshu(a,b){
   if( b ===0 ){
      return a;
}
   let r = a % b;
   return gongyueshu(b,r);

}